﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="Department.aspx.cs" Inherits="EC2011_hk1_BT3_1041061_1041129_1041130.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderTitle" runat="server">
    LIST DEPARTMENT
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderContent" runat="server">
    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" 
    AutoGenerateRows="False" BackColor="White" BorderColor="#999999" 
    BorderStyle="None" BorderWidth="1px" CellPadding="3" 
    DataKeyNames="DepartmentID" DataSourceID="SqlDataSource1" GridLines="Vertical" 
    Height="50px" Width="125px">
    <AlternatingRowStyle BackColor="#DCDCDC" />
    <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
    <Fields>
        <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
            InsertVisible="False" ReadOnly="True" SortExpression="DepartmentID" />
        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        <asp:BoundField DataField="URLHomePage" HeaderText="URLHomePage" 
            SortExpression="URLHomePage" />
        <asp:BoundField DataField="ShowControl" HeaderText="ShowControl" 
            SortExpression="ShowControl" />
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
            ShowInsertButton="True" />
        <asp:ImageField DataImageUrlField="URLPhoto" HeaderText="Photo">
        </asp:ImageField>
    </Fields>
    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
    DeleteCommand="DELETE FROM [Departments] WHERE [DepartmentID] = @DepartmentID" 
    InsertCommand="INSERT INTO [Departments] ([Name], [URLPhoto], [URLHomePage], [ShowControl]) VALUES (@Name, @URLPhoto, @URLHomePage, @ShowControl)" 
    SelectCommand="SELECT * FROM [Departments]" 
    
    UpdateCommand="UPDATE [Departments] SET [Name] = @Name, [URLPhoto] = @URLPhoto, [URLHomePage] = @URLHomePage, [ShowControl] = @ShowControl WHERE [DepartmentID] = @DepartmentID">
    <DeleteParameters>
        <asp:Parameter Name="DepartmentID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="URLPhoto" Type="String" />
        <asp:Parameter Name="URLHomePage" Type="String" />
        <asp:Parameter Name="ShowControl" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="URLPhoto" Type="String" />
        <asp:Parameter Name="URLHomePage" Type="String" />
        <asp:Parameter Name="ShowControl" Type="String" />
        <asp:Parameter Name="DepartmentID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
